package cn.liontalk.microservice.microserviceitem.controller;


import cn.liontalk.microservice.microserviceitem.entity.Item;
import cn.liontalk.microservice.microserviceitem.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
public class ItemController {


    @Autowired
    private ItemService itemService;

    @Value("${server.port}")
    private String port;

    @GetMapping(value = "/item/{id}")
    public Item getItemById(@PathVariable("id") long id) {
        log.info("调用Item服务的端口是=======>{}",port);
        return this.itemService.queryItemById(id);
    }


}
